<template>
    <div class="e-table">
        <div class="top">
            <div class="left">
                <div>
                    <el-button size="mini" class="btn-blue" @click="turnDown">驳回</el-button>
                </div>
            </div>
        </div>
        <el-table
            :max-height="$store.state.tableHeight"
            class="table"
            ref="paramsTable"
            :data="tableData"
            border
            style="width: 100%"
            :height="tableHeight"
            v-sortTable="{ 'tableData': tableData, '_this': this, 'ref': 'paramsTable' }"
        >
            <el-table-column  type="index" label="序号" width="80" align="center">
            </el-table-column>
            <el-table-column label="操作" width="200">
                <template>
                   <el-button size="mini" class="btn-blue" @click="lookPhoto">查看现场图片</el-button>
                </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="parameterName" label="表单编号" min-width="300">
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="parameterValue" label="单据日期" width="400">
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
import { mapMutations } from 'vuex'
import request from '@/api/equip/purchaseAcceptance.js'
import { vueDom, debounce } from '@/utils/common.js'
export default {
    data () {
        return {
            tableData: [],
            // id: JSON.parse(localStorage.vuex).auditParams.id,
            tableHeight: 0,
        }
    },
    created () {
        // this.getTechnical()
    },
    mounted () {
        // table动态高度
        vueDom(
            () => {
                this.tableHeight = document.body.clientHeight - 170
            },
            () => {
                return $('table').length !== 0
            }
        )
        this.fn = () => {
            this.tableHeight = document.body.clientHeight - 170
        }
        window.onresize = debounce(this.fn)
    },
    watch: {
        paramsTable: {
            handler (val) {
                this.setAuditParams({ table: val })
            },
            deep: true
        }
    },
    methods: {
        ...mapMutations(['setAuditParams']),
        //获取参数信息
        getTechnical () {
            request.getLeaseTechnical(this.id).then(res=>{
                this.paramsTableCopy = []
                this.paramsTable = res
                res.map(item=>{
                    this.paramsTableCopy.push(item)
                })
            })
        },
        //驳回
        turnDown () {

        },
        //查看现场照片
        lookPhoto () {

        }
    },
}
</script>

<style lang="scss" scoped>
.e-table {
    min-height: 97.3vh;
}
</style>

